import 'babel-polyfill'
import 'classlist-polyfill'
import Vue from 'vue'
import axios from './router/axios'
import VueAxios from 'vue-axios'
import App from './App'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Avue from '@smallwei/avue'
import '@smallwei/avue/lib/index.css'
import AvueFormDesign from '@sscfaith/avue-form-design'
import './permission' // 权限
import './error' // 日志
import router from './router/router'
import store from './store'
import { loadStyle } from './util/util'
import * as urls from '@/config/env'
import {
  iconfontUrl,
  iconfontVersion
} from '@/config/env'
import * as filters from './filters' // 全局filter
import './styles/common.scss'
import './styles/iconfont/iconfont.css'
import basicContainer from './components/basic-container/main'
import sSearchBar from './components/search-bar/index'
import basicTable from './components/basic-table/index'
import carOwner from './components/business/CarOwner/index'
import orgSelect from './components/business/OrgSelect/index'
import orgMap from './components/business/OrgMapSearch/index'
import EquipmentType from './components/business/EquipmentType/index'
import directives from "@/directives/index";
import mixins from "@/mixins/mixins";
import hlsPlayer from 'vue-hls-player'
import VueMinPlayer from 'vue-mini-player'
import 'vue-mini-player/lib/vue-mini-player.css'
window.axios = axios

import 'video.js/dist/video-js.css'
import 'vue-video-player/src/custom-theme.css'
import 'videojs-contrib-hls'
import VideoPlayer from 'vue-video-player'
Vue.use(VideoPlayer);

Vue.use(hlsPlayer)
Vue.use(VueMinPlayer)
Vue.use(VueAxios, axios)
Vue.use(directives)
Vue.use(ElementUI, {
  size: 'small',
  menuType: 'text'
})

Vue.use(Avue, {
  size: 'small',
  menuType: 'text'
})

Vue.use(router)
Vue.use(mixins)
Vue.use(AvueFormDesign);

// 注册全局容器
Vue.component('basicContainer', basicContainer)
Vue.component('sSearchBar', sSearchBar)
Vue.component('basicTable', basicTable)
Vue.component('carOwner', carOwner)
Vue.component('orgSelect', orgSelect)
Vue.component('orgMap', orgMap)
Vue.component('equipmentType', EquipmentType)
// 加载相关url地址
Object.keys(urls).forEach(key => {
  Vue.prototype[key] = urls[key]
})

//加载过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

// 动态加载阿里云字体库
iconfontVersion.forEach(ele => {
  console.log(iconfontUrl.replace('$key', ele))
  loadStyle(iconfontUrl.replace('$key', ele))
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App),
  data: {
    Bus: new Vue()
  }
}).$mount('#app')
